/* Bantam Java Compiler and Language Toolset.

   Copyright (C) 2007 by Marc Corliss (corliss@hws.edu) and 
                         E Christopher Lewis (lewis@vmware.com).
   ALL RIGHTS RESERVED.

   The Bantam Java toolset is distributed under the following 
   conditions:

     You may make copies of the toolset for your own use and 
     modify those copies.

     All copies of the toolset must retain the author names and 
     copyright notice.

     You may not sell the toolset or distribute it in 
     conjunction with a commerical product or service without 
     the expressed written consent of the authors.

   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS 
   OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE 
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
   PARTICULAR PURPOSE. 
*/

package ast;

import visitor.*;


/** The <tt>ExprStmt</tt> class represents an expression statement
  * (a statement containing a single expression) appearing in a method 
  * declaration.  It contains an expression (<tt>expr</tt>).
  * @see ASTNode
  * @see Stmt
  * */
public class ExprStmt extends Stmt {
    /** The expression within the statement */
    protected Expr expr;
    
    /** ExprStmt constructor
      * @param lineNum source line number corresponding to this AST node
      * @param expr the expression within the statement
      * */
    public ExprStmt(int lineNum, Expr expr) {
	super(lineNum);
	this.expr = expr;
    }
    
    /** Get the expression within the statement
      * @return expression
      * */
    public Expr getExpr() { return expr; }
    
    /** Visitor method
      * @param v visitor object
      * @return result of visiting this node
      * @see visitor.Visitor
      * */
    public Object accept(Visitor v) {
	return v.visit(this);
    }
}
